<template>
    <div>
        <van-nav-bar title="图片上传" left-text="返回" left-arrow @click-left="onClickLeft" />
        <div style="height: 20px;"></div>
        <div style="width: 100%; display: flex;justify-content: center;align-items: center;">
            <div style="width: 650rpx;margin-top: 20rpx;">
                <!-- <van-uploader preview-size="100" :upload-text="labels[fileImgList.length]" multiple max-count="3"
                    v-model="fileImgList" :deletable="true" /> -->
                <van-uploader preview-size="100" :upload-text="labels[fileImgList.length]" max-count="3"
                    v-model="fileImgList" :deletable="true" />
            </div>
        </div>
        <van-cell-group :border="false">
            <van-cell title="提示" label="请根据提示上传正脸、左侧脸、右侧脸3张照片！" :border="false" />
        </van-cell-group>
        <div style="width: 100%;display: flex;align-items: center;justify-content: center;margin-top: 20rpx;">
            <div style="width: 95%;margin-bottom: 50rpx;">
                <van-button round type="info" size="large" @click="nextImgBtn()">
                    下一步
                    <!-- <router-link :to="nextImgBtn()" >下一步</router-link> -->
                </van-button>
            </div>
        </div>
        <!-- <van-dialog v-model:show="show" title="提示">
            <div style="height: 50px; display: flex;justify-content: center;align-items: center;">
                <label >{{ hint }}</label>
            </div>
            
        </van-dialog> -->

    </div>
</template>
  
<script>
import { Toast } from 'vant';


export default {
    name: 'Faceimg',
    components: {

    },
    data() {
        return {
            formValue: '',
            labels: ["正脸", "左侧脸", "右侧脸", "仰头照", "低头照", "身份证件"],
            // fileImgs: [],
            fileImgList: [],
            fileImgCards: [],
            show: false,
            infoCheck:'0',
            hint: '',
        }
    },
    methods: {
        onClickLeft() {
            // this.$router.push({
            //     name: 'Home',
            //     params: {fileImgList:this.fileImgList,fileImgCards:this.fileImgCards},
            // })
            // history.back()
            this.$router.back();
        },
        // afterRead(file,detail){
        //     var fileImgList = this.fileImgList
        //     // fileImgList.push({file:file.file})
        //     fileImgList.push(file)
        //     this.fileImgList = fileImgList
        //     console.log(this.fileImgList);
        // },
        // deleteImg(file,detail){
        //     var fileImgList = this.fileImgList
        //     fileImgList.splice(detail.index,1)
        //     this.fileImgList = fileImgList
        //     console.log(fileImgList);
        // },
        nextImgBtn() {
            var fileImgList = this.fileImgList
            if (this.infoCheck<'2') {
                Toast('不可重复提交！')
                return
            }
            if (fileImgList.length < 3) {
                // this.show = true
                // this.hint = '请根据提示上传3张照片！'
                Toast('请根据提示上传正脸、左侧脸、右侧脸3张照片！')
                return
            }
            // window.sessionStorage.setItem("fileImgList", JSON.stringify(fileImgList))
            // console.log(this.fileImgList)
            this.$router.push({
                name: 'Idcard',
                // params: {fileImgList:fileImgList,fileImgCards:this.fileImgCards},
                params: { fileImgList: fileImgList },

            })
            // return { name: 'Idcard', params: { file: fileImgList } }
        },

    },
    created() {
        // var datainfo = JSON.parse(window.sessionStorage.getItem('datainfo'))
        // var fileImgList = window.sessionStorage.getItem('fileImgList')
        // var fileImgList = this.$route.params.fileImgList
        // var fileImgCards = this.$route.params.fileImgCards
        // this.fileImgList = JSON.parse(fileImgList)
        // this.fileImgs = JSON.parse(fileImgList)
        // console.log(fileImgList);
        // this.fileImgList = fileImgList
        // this.fileImgs = fileImgList
        // this.fileImgCards =fileImgCards

        // console.log(datainfo)
    },
    activated() {
        // if (!this.$route.meta.isBack) {
        // 如果isBack是false，表明需要获取新数据，否则就不再请求，直接使用缓存的数据 this.getData();
        var data = JSON.parse(window.sessionStorage.getItem('datainfo'))
        this.infoCheck = data.infoCheck
        // }
        // 恢复成默认的false，避免isBack一直是true，导致下次无法获取数据 this.$route.meta.isBack=false

    },
}
</script>
  
<style lang="less"></style>
  